package com.qwt.part_time_api.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.qwt.part_time_api.pojo.Type;
import com.qwt.part_time_api.service.TypeService;
import com.qwt.part_time_api.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 君子慎独
 * @create 2021/12/25 0025 20:43
 */
@RestController
@RequestMapping("/type")
@Api(tags = {"分类"})
public class TypeController {

    @Autowired
    private TypeService typeService;

    /**
     * 查询全部分类
     *
     * @return typeList
     */
    @GetMapping("/allType")
    @ApiOperation(value = "分类列表", notes = "查询全部分类")
    @ApiOperationSupport(author = "Tzeao",
            ignoreParameters = {"params.newsType"})
    @ApiResponses(@ApiResponse(code = 200, message = "成功", response = Type.class))
    public Result allType() {
        return typeService.findAllType();
    }
}
